package DAO;

import java.util.Date;
import java.util.List;

import DTO.ScheduleDTO;

import model.impl.Schedule;
import model.impl.Station;

/**
 *  ScheduleDAO interface, extend GenericDAO interface using as parameters
 *  entity of Schedule and Integer class as an ID. It also adds some specific 
 *  to Schedule entity methods.
 */
public interface ScheduleDAO extends GenericDAO<Schedule, Integer> {
	
	/**
	 * Looks for all schedules that satisfy the given in parameters requirements
	 * 
	 * @param beginStation - departure station 
	 * @param endStation   - arrival station
	 * @param beginTime	   - date of departure
	 * @param endTime	   - date of arrival
	 * @return			   - List of ScheduleDTO which satisfy given parameters
	 * 					     or null if such Schedules was not found
	 */
	public List<ScheduleDTO> findRequiredTrains(Station beginStation, Station endStation, 
			Date beginTime, Date endTime);
	
	/**
	 * Checks given station and looks for all schedules that has this station as
	 * departure or arrival one.
	 * 
	 * @param  station - Station entity for which to look for Schedule
	 * @return         - List of Schedules which has the given station as an instance 
	 * 					 variable or null if nothing was found
	 */
	public List<Schedule> findAllSchedulesByStation(Station station);
	
	/**
	 * Looks for all schedules that satisfy the given in parameters DTO object
	 * 
	 * @param scheduleDTO  - which DTO object should Schedule instance satisfy
	 * @return			   - Schedule entity object which satisfy given DTO
	 * 					     or null if such Schedule was not found
	 */
	public Schedule findScheduleByScheduleDTO(ScheduleDTO scheduleDTO);
	
	/**
	 * Checks all schedules and determine that a ScheduleDTO is not dissonantly to
	 * all Schedules
	 * 
	 * @param scheduleDTO - parameter for DTO object which it's required to check 
	 * 						for not to be dissonantly
	 * @return            - list of Schedule entity object which contradict to the
	 * 						given DTO, or null if such Schedules were no found
	 */
	public List<Schedule> findIsSchedulePossible(ScheduleDTO scheduleDTO);
	
}
